home *** CD-ROM | disk | FTP | other *** search
/ VisualFX for ImageFX / VisualFX for Image FX 2.adf / Files / ARexx / 02 / 09.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1996-02-04  |  5.8 KB  |  303 lines

  1. /*
  2.                           Visual FX Arexx Script
  3.                            Written By J.L. White
  4.                          (C)1997 Merlin's Software
  5. */
  6.  
  7. Options Results
  8. address "IMAGEFX.1"
  9. ScreenToFront
  10. Undo Off
  11. if exists("libs:flyer.library") then do
  12.     TOASTERLIB="ToasterARexx.port"
  13.     call remlib('ToasterARexx.port')
  14.     call remlib('PROJECT_REXX_PORT')
  15.     call addlib('PROJECT_REXX_PORT' , 0)
  16.     call addlib(TOASTERLIB,0)
  17.     end
  18. call Settings()
  19. call open TempFile,"VFXIFX:TempDrawer/"FXNum".txt",R
  20. line = readln(TempFile)
  21. Type = strip(line)
  22. call close (TempFile)
  23. j=0
  24. TFrames = Frames
  25. if Field = 1 then TFrames = Frames*2
  26. do i = 1 to Frames
  27.     call open TempFile,"RAM:VFXNums",W
  28.     call writeln TempFile,right(i,5,'0')
  29.     call writeln TempFile,right(Frames,5,'0')
  30.     call close TempFile
  31.     f=0
  32.     Redraw Off
  33.     FieldSet = 0
  34.     if Padding ~= -1 & i = 1 then call PadIt(1)
  35.     call LoadB()
  36.     call LoadA()
  37.     j = j+ 1
  38.     call DoIt()
  39.     Redraw On
  40.     call SaveIt()
  41.         if Field = 1 then do
  42.             Redraw Off
  43.             FieldSet = 1
  44.             call LoadB()
  45.             call LoadA()
  46.             j = j + 1
  47.             call DoIt()
  48.             Redraw On
  49.             call SaveIt()
  50.             end 
  51.     if Padding ~= -1 & i = Frames then call PadIt(2)
  52.     end
  53.     if SaveType = 0 then do
  54.         if Padding = -1 then
  55.             call MakeIcon(SaveName,(Frames-10))
  56.         else
  57.             call MakeIcon(SaveName,(Padding+(Frames-10)))
  58.         end
  59.     Undo On
  60. exit
  61.  
  62.  
  63. PadIt:
  64. arg PadNum
  65.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  66.         Undo On
  67.         exit
  68.         end
  69.          if PadNum = 1 then do
  70.        if IAType = 0 then do
  71.         do Pad = Padding to 1 by -1
  72.             LoadBuffer PicAName Force StartA-(Pad-1)
  73.             call Switcher(TOSW)
  74.             call Switcher(MDV1)
  75.             Render Go
  76.                 call RecordAdd(SaveName,2,6,Compression)
  77.             end
  78.         end
  79.        if IAType = 1 then do
  80.         LoadBuffer PicAName Force 1
  81.         call Switcher(TOSW)
  82.         call Switcher(MDV1)
  83.         Render Go
  84.             call RecordAdd(SaveName,2*Padding,6,Compression)
  85.         end
  86.        if IAType = 2 then do
  87.         LoadBuffer PicAName Force
  88.         call Switcher(TOSW)
  89.         call Switcher(MDV1)
  90.         Render Go
  91.             call RecordAdd(SaveName,2*Padding,6,Compression)
  92.         end
  93.        if IAType = 3 then do
  94.         do Pad = Padding to 1 by -1
  95.             LoadBuffer PicAName""right(StartA-(Pad-1),3,'0') Force
  96.             call Switcher(TOSW)
  97.             call Switcher(MDV1)
  98.             Render Go
  99.                 call RecordAdd(SaveName,2,6,Compression)
  100.             end
  101.         end
  102.     end 
  103.     else do
  104.        if IBType = 0 then do
  105.         do Pad = 1 to Padding
  106.             LoadBuffer PicBName Force StartB+Pad+Frames
  107.             call Switcher(TOSW)
  108.             call Switcher(MDV1)
  109.             Render Go
  110.                 call RecordAdd(SaveName,2,6,Compression)
  111.             end
  112.         end
  113.        if IBType = 1 then do
  114.         LoadBuffer PicBName Force 1
  115.         call Switcher(TOSW)
  116.         call Switcher(MDV1)
  117.         Render Go
  118.             call RecordAdd(SaveName,2*Padding,6,Compression)
  119.         end
  120.        if IBType = 2 then do
  121.         LoadBuffer PicBName Force
  122.         call Switcher(TOSW)
  123.         call Switcher(MDV1)
  124.         Render Go
  125.             call RecordAdd(SaveName,2*Padding,6,Compression)
  126.         end
  127.        if IBType = 3 then do
  128.         do Pad = 1 to Padding
  129.             LoadBuffer PicBName""right(StartB+Pad+Frames),3,'0') Force
  130.             call Switcher(TOSW)
  131.             call Switcher(MDV1)
  132.             Render Go
  133.                 call RecordAdd(SaveName,2,6,Compression)
  134.             end
  135.         end
  136.     end
  137. return
  138.  
  139. LoadA:
  140.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  141.         Undo On
  142.         exit
  143.         end
  144.     if j = TFrames then return
  145.     if IAType = 0 then do
  146.         LoadBuffer PicAName Force i+StartA
  147.         end
  148.     if IAType = 1 then do
  149.         LoadBuffer PicAName Force 1
  150.         end
  151.     if IAType = 2 then do
  152.         LoadBuffer PicAName Force
  153.         end
  154.     if IAType = 3 then do
  155.         LoadBuffer PicAName""right(i+StartA,3,'0') Force
  156.         end
  157.  
  158. return
  159.  
  160. LoadB:
  161.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  162.         Undo On
  163.         exit
  164.         end
  165.     if j = 1 then return
  166.     if IBType = 0 then do
  167.         LoadBuffer PicBName Force i+StartB
  168.         end
  169.     if IBType = 1 then do
  170.         LoadBuffer PicBName Force 1
  171.         end
  172.     if IBType = 2 then do
  173.         LoadBuffer PicBName Force
  174.         end
  175.     if IBType = 3 then do
  176.         LoadBuffer PicBName""right(i+StartB,3,'0') Force
  177.         end
  178.     Swap
  179. return
  180.  
  181.  
  182. DoIt:
  183.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  184.         Undo On
  185.         exit
  186.         end
  187.     if j = TFrames then do
  188.         Swap
  189.         return
  190.         end
  191.     if j = 1 then do
  192.         GetMain
  193.         parse var result Name Width Height Blah
  194.         return
  195.         end
  196.  
  197.     if Type = 0 then do
  198.         MainNum = Width
  199.         Num = (((j-1) * MainNum)/(TFrames-1))
  200.         Num1 = trunc((MainNum-Num)/2)
  201.         Num2 = trunc((MainNum/2)+Num/2)
  202.  
  203.         Scissors
  204.         Box 0 0 MainNum/2 Height
  205.         GetBrush
  206.         parse var result Name BWidth BHeight Blah
  207.         BrushHandle BWidth 0
  208.         Swap
  209.         DrawMode Darken
  210.         Point Num1+20 0
  211.         DrawMode Normal
  212.         Point Num1 0
  213.         KillBrush
  214.         Swap
  215.  
  216.         Scissors
  217.         Box MainNum/2 0 MainNum/2 Height
  218.         GetBrush
  219.         parse var result Name BWidth BHeight Blah
  220.         BrushHandle 0 0
  221.         Swap
  222.         DrawMode Darken
  223.         Point Num2-20 0
  224.         DrawMode Normal
  225.         Point Num2 0
  226.         KillBrush
  227.         end
  228.     else do
  229.         MainNum = Height
  230.         Num = (((j-1) * MainNum)/(TFrames-1))
  231.         Num1 = trunc((MainNum-Num)/2)
  232.         Num2 = trunc((MainNum/2)+Num/2)
  233.  
  234.         Scissors
  235.         Box 0 0 Width MainNum/2
  236.         GetBrush
  237.         parse var result Name BWidth BHeight Blah
  238.         BrushHandle 0 BHeight
  239.         Swap
  240.         DrawMode Darken
  241.         Point 0 Num1+12
  242.         DrawMode Normal
  243.         Point 0 Num1
  244.         KillBrush
  245.         Swap
  246.  
  247.         Scissors
  248.         Box 0 MainNum/2 Width MainNum/2
  249.         GetBrush
  250.         parse var result Name BWidth BHeight Blah
  251.         BrushHandle 0 0
  252.         Swap
  253.         DrawMode Darken
  254.         Point 0 Num2-12
  255.         DrawMode Normal
  256.         Point 0 Num2
  257.         KillBrush
  258.         end
  259.  
  260. return
  261.  
  262. SaveIt:
  263.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  264.         Undo On
  265.         exit
  266.         end
  267.     if SaveType = 0 then do
  268.         call Switcher(TOSW)
  269.         call Switcher(MDV1)
  270.  
  271.         Render Go
  272.         if Field = 1 then
  273.                 call RecordAdd(SaveName,1,6,Compression)
  274.         else
  275.                 call RecordAdd(SaveName,2,6,Compression)
  276.         end
  277.  
  278.     if SaveType = 1 then do
  279.         if Field = 1 then do
  280.             f= f + 1
  281.             if f = 1 then
  282.                 SaveBufferAs ILBM "VFXIFX:TempDrawer/PicA"
  283.             if f = 2 then do
  284.                 GetMain
  285.                 parse var result Name Width Height Blah
  286.                 Scale Width Height/2
  287.                 Swap
  288.                 LoadBuffer "VFXIFX:TempDrawer/PicA" Force
  289.                 Scale Width Height/2
  290.                 Hook Interlace
  291.                 SaveBufferAs ILBM SaveName""right(i,3,'0')
  292.                 f = 0
  293.                 end
  294.             end
  295.         else do
  296.             SaveBufferAs ILBM SaveName""right(i,3,'0')
  297.             end    
  298.         end
  299.  
  300. return
  301.  
  302.  
  303.